#include "SetUserName.h"
#include "Protocol/Protocol.h"
#include "Protocol/ProtocolHelper.h"

namespace Command{

SetUserName::SetUserName(QString name) :
	TransactionCommand(SET_USER_NAME, EMPTY_RESPONSE),
	_userName(name)
{
}

void SetUserName::execute()
{
	QByteArray data;
	QDataStream writeStream(&data, QIODevice::WriteOnly);

	Protocol::Helper::stringToDataStream(writeStream, _userName);

	sendData(data);
}

void SetUserName::processResponse(QByteArray& data)
{
	Q_UNUSED(data)
	setResponseRecieved();
}

}
